package loveqq.niceexcel.converter.internal.bool;

import loveqq.niceexcel.annotation.internal.Internal;
import loveqq.niceexcel.converter.CellData;
import loveqq.niceexcel.converter.ConvertContext;
import loveqq.niceexcel.converter.Converter;
import org.apache.poi.ss.usermodel.CellType;

/**
 * @author zhongjh@tsintergy.com
 * @date 2022-08-19
 */
@Internal
public class BooleanBooleanConverter implements Converter<Boolean> {
    @Override
    public Class<Boolean> supportJavaType() {
        return Boolean.class;
    }

    @Override
    public CellType supportExcelType() {
        return CellType.BOOLEAN;
    }

    @Override
    public Boolean convertToJavaData(CellData<?> cellData, ConvertContext context) {
        return cellData.getBooleanValue();
    }

    @Override
    public CellData<?> convertToExcelData(Boolean data, ConvertContext context) {
        return new CellData<>(data);
    }
}
